package example.simple_mindmap.consistency.strategy.scheme;

import example.simple_mindmap.consistency.ConsistencyData;
import org.springframework.stereotype.Component;

/**
 * @Program: 8.mindmap
 * @Author: 海里的鱼
 * @Create: 2024-08-28 09:27
 * @Name: 【直接写】方案
 * @Desc: 直接调用写入API来实现数据一致性
 */
@Component
public class DirectScheme implements IConsistencyScheme{

    /** ---------------------------------------------------------------------------------------------------------------------
     * @Method  : 执行方案
     * @Describe: 将【写入数据】包装成【写入任务】交给线程池执行
     **/
     @Override
    public boolean executeScheme(ConsistencyData data) throws Exception {
        return data.getWriteFunc().crudData(data.getData());
    }
}
